using Newtonsoft.Json;
using BootstrapBlazorApp.Server.LLMs.messages;
namespace BootstrapBlazorApp.Server.LLMs.model.TongYi;


public class TongYiOutPut
{
    [JsonProperty("statusCode")]
    public int StatusCode { get; set; }
    [JsonProperty("request_id")]
    public required string RequestId { get; set; }
    [JsonProperty("code")]
    public required string Code { get; set; }
    [JsonProperty("message")]
    public required string Message { get; set; }
    [JsonProperty("output")]
    public required ModelOutput OutPut { get; set; }
    [JsonProperty("usage")]
    public required TokenUsage Usage { get; set; }
    
    public class TokenUsage
    {
        [JsonProperty("input_tokens")]
        public int InputTokens { get; set; }
        [JsonProperty("output_tokens")]
        public int OutputTokens { get; set; }
        [JsonProperty("total_tokens")]
        public int TotalTokens { get; set; }
    }

    public Choice[] GetChoices()
    {
        return this.OutPut.Choices;
    }
    
    public class ModelOutput
    {
        [JsonProperty("text")]
        public required string Text { get; set; }
        [JsonProperty("finish_reason")]
        public required string FinishReason { get; set; }
        [JsonProperty("choices")]
        public required Choice[] Choices { get; set; }
    }

    public class Choice
    {
        [JsonProperty("finish_reason")]
        public required string FinishReason { get; set; }
        [JsonProperty("message")]
        public required ReturnMessage ReturnMessage { get; set; }
    }

}








